import { request } from '@boeyo/portal';

/**
 * 监测列表树形列表
 * null
 */
export const tree = (data) => {
  return request({
    url: '/monitoring/tree',
    method: 'POST',
    data,
  });
};

/**
 * 测点触发事件 测点触发事件
 * null
 */
export const pointEvent = (params) => {
  return request({
    url: '/event/pointEvent',
    method: 'GET',
    params,
  });
};

/**
 * 历史数据波形
 */
export const fetchHistoryData = (params) => {
  return request({
    url: 'deviceData/history',
    params,
    skipError: true,
  });
};

/**
 * 报告产出文件下载
 * null
 */
export const downloadGenerateById = (generateId, docType = 'pdf') => {
  return request({
    url: `/produce/downloadGenerateById/${generateId}/${docType}`,
    method: 'GET',
    responseType: 'blob',
    closeDownload: true,
  });
};

/**
 * 生成测点报告
 * null
 */
export const createEventDataReport = (id) => {
  return request({
    url: `/produce/createEventDataReport/${id}`,
    method: 'GET',
    skipError: true,
  });
};

/**
 * 傅立叶谱
 * null
 */
export const signal = (data) => {
  return request({
    url: `/deviceData/signal`,
    method: 'post',
    data,
  });
};

/**
 * 反应谱
 * null
 */
export const responseSpectrum = (data) => {
  return request({
    url: `/deviceData/responseSpectrum`,
    method: 'post',
    data,
  });
};
